<template>
	<view class="myBox">
		<view class="topTitle flex-sp-center">
			<view class="Title">
				医联•互联网医院
				<view class="">开启美好的一天</view>
			</view>
			<view class="flex-center-center">
				<view class="ScanCode flex-center-center">
					<image src="@/static/my/scan.png" mode=""></image>
					扫一扫
				</view>
				<view class="tz">
					<image src="@/static/CommonTools/tz.png" mode=""></image>
				</view>
			</view>
		</view>
		<view class="doctor">
			<view class="" @click="goinfo('pages/my/MyProfile/MyProfile')">
				<view class="title flex-center">
					<image :src="data.avatar" mode=""></image>
					<view class="nameBox">
						<view class="name">
							{{ data.name }}
							<text>{{ data.titleName }}</text>
							<text>{{ data.departName }}</text>
						</view>
						<view class="typeBox" v-if="levelName">
							<text>{{ data.levelName }}</text>
							{{ data.hospitalName }}
						</view>
						<view class="setUp">点击设置资料</view>
					</view>
					<view class="code" @click.stop="Uppop()">
						<image src="@/static/my/code.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		<view class="listTop">

		</view>
		<view class="list">
			<view class="row mb_30" v-for="n in list" :key="n.id" @click="goDetails(n.id)">
				<view class="nameBox B_xian flex-center">
					<image :src="n.patientAvatar" mode=""></image>
					<view class="name">
						{{n.patientName}}
					</view>
					<text>女</text>
					<view class="shu"></view> <text>{{n.patientAge}}岁</text>
				</view>
				<view class="text mt_30">
					<view class="textTitle ">
						诊断结果：
					</view>
					<view class="textInfo rowShow_2">
						{{n.diagnosis}}
					</view>
				</view>
				<view class="text mt_30">
					<view class="textTitle ">
						处方编号：
					</view>
					<view class="textInfo ">
						cf202407049387
					</view>
				</view>
				<view class="text mt_30 pb_34 B_xian">
					<view class="textTitle ">
						发起医生：
					</view>
					<view class="textInfo">
						<view class="textName flex-center">
							<view class="name">
								{{n.doctorName}}
							</view>
							<text>{{n.titleName}}</text>
							<view v-if="n.titleName&&n.departName" class="shu"></view> <text>{{n.departName}}</text>
						</view>
					</view>
				</view>
				<view class="time flex-sp-center">
					<view class="">
						<uni-icons type="calendar" size="16" color="#999"></uni-icons> 2024-05-27 18:00
					</view>
					<view class="">
						查看详情 <uni-icons type="right" size="16" color="#999"></uni-icons>
					</view>
				</view>
			</view>
		</view>
		<view class="kong">

		</view>
		<uni-popup ref="popup" type="center">
			<view class="">
				<QRCode :code="data.id"></QRCode>
			</view>
		</uni-popup>
		<UnauditedPup :data="data.auditStatus"></UnauditedPup>
		<view class="PharmacistTabber">
			<view class="">
				<image src="@/static/icon/11.png" mode=""></image>
				<view class="act">
					工作台
				</view>
			</view>
			<view class="" @click="goinfo('pages/Pharmacist/my')">
				<image src="@/static/icon/4.png" mode=""></image>
				<view class="">
					我的
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getPharmacistInfo,
		getPrescriptionInfoPage
	} from '@/api/user'
	import {
		createGroup
	} from '@/utils/TIM'
	export default {
		data() {
			return {
				data: {},
				list: [],
				request: {
					pageNo: 1,
					pageSize: 10,
					auditStatus: 0
				},
				maxNum: "",
			}
		},
		onLoad() {
			this.getPharmacistInfo()
			this.getPrescriptionInfoPage()
		},
		onReachBottom() {
			if (this.maxNum <= this.request.pageNo) return
			this.request.pageNo = this.request.pageNo + 1
			this.getPrescriptionInfoPage()
		},
		methods: {
			Uppop() {
				this.$refs.popup.open('center')
			},
			// 创建会话
			handleCreateConversation(userID) {
				createGroup(userID)
			},
			getPharmacistInfo() {
				getPharmacistInfo().then(res => {
					this.data = res.data
				})
			},
			getPrescriptionInfoPage() {
				getPrescriptionInfoPage(this.request).then(res => {
					this.list.push(...res.data.list)
					let num = res.data.total / this.request.pageSize
					if (num.toString().includes('.')) {
						num = Math.ceil(num)
					}
					this.maxNum = num
				})
			},
			goConsultationList(e) {
				uni.navigateTo({
					url: `/pages/ConsultationRoom/consultationList/consultationList?type=${e}`,
				})
			},
			goConsultationRoom(e) {
				uni.navigateTo({
					url: `/pages/ConsultationRoom/index?type=${e}`,
				})
			},
			goDetails(e) {
				uni.navigateTo({
					url: `/pages/Pharmacist/details/details?id=${e}`,
				})
			},
			goinfo(e, id) {
				if (id) {
					uni.navigateTo({
						url: `/${e}?id=${id}`,
					})
				} else {
					uni.navigateTo({
						url: `/${e}`,
					})
				}
			},
		},
	}
</script>

<style lang="less" scopde>
	.listTop {
		background-image: url(@/static/Pharmacist/titleBg.png);
		height: 94rpx;
		background-size: 100% 100%;
	}

	.PharmacistTabber {
		width: 750rpx;
		height: 98rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(153, 153, 153, 0.3);
		position: fixed;
		bottom: 0;
		display: flex;
		align-items: center;
		justify-content: space-around;
		font-weight: 500;
		font-size: 26rpx;
		text-align: center;
		color: #999999;

		.act {
			color: #3E6EFE;
		}

		image {
			width: 38rpx;
			height: 38rpx;
		}
	}

	.listTop {}

	.shu {
		width: 1rpx;
		height: 25rpx;
		background-color: #eee;
		margin: 0 12rpx;
	}

	.B_xian {
		border-bottom: 1px solid #EEEEEE;
	}

	.row {
		width: 750rpx;
		min-height: 501rpx;
		background: #FFFFFF;
		padding: 15rpx 50rpx;
		box-sizing: border-box;

		.time {
			margin-top: 30rpx;
			font-weight: 500;
			font-size: 26rpx;
			color: #999999;
		}

		.text {
			display: flex;
			font-weight: 500;
			font-size: 28rpx;
			color: #333333;

			.textTitle {
				width: 150rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #999999;
			}

			.textInfo {
				width: 550rpx;

				// flex: 1;
				.textName {
					.name {
						font-weight: bold;
						font-size: 32rpx;
						color: #333333;
						margin: 0 10rpx 0 0;
					}

					text {
						// margin: 0 18rpx;
					}
				}
			}
		}

		.nameBox {
			height: 115rpx;

			.name {
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
				margin: 0 20rpx;
			}

			text {
				margin: 0 12rpx;
			}

			image {
				width: 94rpx;
				height: 94rpx;
				border-radius: 50%;
			}
		}

	}

	.Unaudited {
		width: 100%;
		height: 100vh;
		position: fixed;
		top: 0%;
		left: 0%;
		background-color: #00000080;


		.box {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			border-radius: 20rpx;
			width: 400rpx;
			height: 420rpx;
			background-color: #fff;
			text-align: center;
			padding: 20rpx;
			box-sizing: border-box;

			image {
				width: 205rpx;
				height: 168rpx;
			}

			.title {
				text-align: center;
				font-weight: bold;
				font-size: 36rpx;
				color: #333;
				margin-top: 20rpx;
			}

			.btn {
				font-weight: 500;
				font-size: 26rpx;
				color: #3E6EFE;
				margin-top: 25rpx;
			}

			.text {
				margin-top: 10rpx;
				width: 100%;
				color: #999;
				font-size: 26rpx;
				text-align: left;
			}
		}
	}

	.myBox {
		min-height: 100vh;
		background-image: url(@/static/Pharmacist/indexBg.png);
		background-size: 100% 1026rpx;
		background-repeat: no-repeat;
		box-sizing: border-box;


		.doctor {
			min-height: 182rpx;
			border-radius: 30rpx;
			padding: 0 30rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-around;

			&>view {
				width: 100%;
			}

			.title {
				.code {
					image {
						width: 63rpx;
						height: 60rpx;
					}
				}

				.nameBox {
					flex: 1;
				}

				.name {
					font-weight: bold;
					font-size: 32rpx;
					margin-bottom: 10rpx;
					color: #333333;

					text {
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
						margin-left: 19rpx;
					}
				}

				image {
					width: 118rpx;
					height: 118rpx;
					border-radius: 50%;
					margin-right: 21rpx;
				}
			}

			.typeBox {
				margin-top: 5rpx;

				text {
					display: inline-block;
					width: 63rpx;
					height: 33rpx;
					background: #def7ed;
					border-radius: 10rpx;
					font-weight: 500;
					font-size: 22rpx;
					color: #23cc88;
					text-align: center;
					line-height: 33rpx;
					margin-right: 10rpx;
				}
			}

			.setUp {
				margin-top: 5rpx;
				font-weight: 500;
				font-size: 24rpx;
				color: #999999;
			}
		}

		.topTitle {
			padding: 51rpx 30rpx 0;
			box-sizing: border-box;

			.Title {
				font-weight: 800;
				font-size: 34rpx;
				color: #333333;

				view {
					font-weight: 500;
					font-size: 24rpx;
					color: #999999;
				}
			}

			.tz {
				image {
					width: 60rpx;
					height: 68rpx;
				}
			}

			.ScanCode {
				width: 145rpx;
				height: 60rpx;
				border-radius: 35rpx;
				border: 2px solid #3e6efe;
				font-weight: 500;
				font-size: 24rpx;
				color: #3e6efe;
				margin-right: 32rpx;

				image {
					width: 24rpx;
					height: 24rpx;
					margin-right: 9rpx;
				}
			}
		}
	}
</style>